Image prediction method and apparatus for performing intra prediction

ABSTRACT

An image decoding method according to the present document may comprise the steps of: deriving an intra prediction mode for a current block; deriving reference samples located around the current block; generating a prediction sample for the current block on the basis of the intra prediction mode and the reference samples; and generating residual samples for the current block on the basis of the prediction sample, wherein the step of generating the prediction sample for the current block may comprise the steps of: deriving an interpolation filter, which is to be applied to the reference sample, on the basis of the prediction mode of the current block or the size of the current block; and generating the prediction sample by applying the derived interpolation filter to the reference sample.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is the National Stage filing under 35 U.S.C. 371 ofInternational Application No. PCT/KR2019/011913, filed on Sep. 16, 2019,which claims the benefit of U.S. Provisional Application No. 62/731,143filed on Sep. 14, 2018, the contents of which are all herebyincorporated by reference herein in their entirety.

BACKGROUND OF THE DISCLOSURE Field of the Disclosure

The present document relates generally to an image coding technologyand, more particularly, to an image coding method based on intraprediction and an apparatus therefor.

Related Art

Recently, the demand for high resolution, high quality image/video suchas 4K, 8K or more Ultra High Definition (UHD) image/video is increasingin various fields. As the image/video resolution or quality becomeshigher, relatively more amount of information or bits are transmittedthan for conventional image/video data. Therefore, if image/video dataare transmitted via a medium such as an existing wired/wirelessbroadband line or stored in a legacy storage medium, costs fortransmission and storage are readily increased.

Moreover, interests and demand are growing for virtual reality (VR) andartificial reality (AR) contents, and immersive media such as hologram;and broadcasting of images/videos exhibiting image/video characteristicsdifferent from those of an actual image/video, such as gameimages/videos, are also growing.

Therefore, a highly efficient image/video compression technique isrequired to effectively compress and transmit, store, or play highresolution, high quality images/videos showing various characteristicsas described above.

SUMMARY

A technical objective of the present document is to provide a method andapparatus which increase image coding efficiency.

Another technical objective of this document is to provide an intraprediction method and apparatus for interpolating reference samplesunder the consideration of the size and prediction mode of a currentblock.

Still another technical objective of this document is to provide anintra prediction method and apparatus which are capable of effectivelyderiving reference samples under the consideration of the distancebetween a prediction sample and a reference sample.

Still another technical objective of this document is to provide animage coding method and apparatus which are capable of increasing theprecision of intra prediction.

According to an embodiment of the present document, there is provided animage decoding method performed by a decoding apparatus, the methodincluding: deriving an intra prediction mode for a current block;deriving reference samples adjacent to the current block; generating aprediction sample for the current block based on the intra predictionmode and the reference samples; generating a reconstructed picture forthe current block based on the prediction sample, wherein the generatingof the prediction sample for the current block includes deriving aninterpolation filter to be applied to the reference sample based on aprediction mode of the current block or the size of the current block;and generating the prediction sample by applying the derivedinterpolation filter to the reference sample.

According to another embodiment of the present document, there isprovided an image encoding method by an encoding apparatus, the methodincluding: deriving an intra prediction mode for a current block;deriving reference samples adjacent to the current block; generating aprediction sample for the current block based on the intra predictionmode and the reference samples; generating residual samples for thecurrent block based on the prediction sample; and encoding imageinformation including information on the intra prediction mode and theresidual sample, wherein the generating of the prediction sample for thecurrent block includes deriving an interpolation filter to be applied tothe reference sample based on a prediction mode of the current block orthe size of the current block; and generating the prediction sample byapplying the derived interpolation filter to the reference sample.

According to still another embodiment of the present document, there isprovided an image encoding apparatus, the apparatus including apredictor which derives an intra prediction mode for a current blockbased on information on a prediction mode of the current block, derivesreference samples adjacent to the current block, generates a predictionsample for the current block based on the intra prediction mode and thereference samples, and generates a reconstructed picture for the currentblock based on the prediction sample, wherein the predictor derives aninterpolation filter to be applied to the reference sample based on aprediction mode of the current block or the size of the current block inorder to generate the prediction sample for the current block, andgenerates the prediction sample by applying the derived interpolationfilter to the reference sample.

According to still another embodiment of the present document, a digitalstorage medium in which image data including encoded image informationgenerated according to the image encoding method performed by anencoding apparatus is stored may be provided.

According to still another embodiment of the present document, a digitalstorage medium in which image data including encoded image informationcausing the decoding apparatus to perform the image decoding method isstored may be provided.

According to an embodiment of the present document, it is possible toincrease general image/video compression efficiency.

According to an embodiment of the present document, it is possible toeffectively derive an interpolation filter that interpolates a referencesample under the consideration of the size and prediction mode of thecurrent block.

According to an embodiment of the present document, it is possible toeffectively derive a reference sample under the consideration of adistance between a prediction sample and a reference sample.

According to an embodiment of the present document, an image codingmethod and apparatus which are capable of increasing the precision ofintra prediction can be provided.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 schematically represents an example of a video/image codingsystem to which the present document may be applied.

FIG. 2 is a diagram schematically illustrating a configuration of avideo/image encoding apparatus to which the present document may beapplied.

FIG. 3 is a diagram schematically illustrating a configuration of avideo/image decoding apparatus to which the present document may beapplied.

FIG. 4A is a diagram representing 67 intra prediction modes according toan embodiment of the present document.

FIG. 4B is a diagram further showing wide-angle intra prediction modesaccording to an embodiment of the present document.

FIG. 5 is a control flowchart illustrating an encoding method that maybe applied in the intra prediction according to an embodiment of thepresent document.

FIG. 6 is a diagram showing an example of a reference pixel that may beused for intra prediction.

FIG. 7 is a diagram illustrating reference pixel interpolation withrespect to a location of a fractional pixel.

FIG. 8 schematically represents an encoding apparatus performing animage encoding method according to FIG. 5.

FIG. 9 is a control flowchart illustrating a decoding method to whichintra prediction can be applied according to an embodiment of thepresent document.

FIG. 10 schematically represents a decoding apparatus performing adecoding method according to FIG. 9.

FIG. 11 is a control flowchart illustrating an intra prediction methodaccording to an embodiment of the present document.

FIG. 12 is a control flowchart illustrating an intra prediction methodaccording to another embodiment of the present document.

FIG. 13 is a control flowchart illustrating an intra prediction methodaccording to still another embodiment of the present document.

FIG. 14 is a diagram illustrating how a reference sample is obtainedwhen a prediction angle is a negative number according to an example.

FIGS. 15 and 16 are diagrams illustrating how to perform paddingdepending on a negative angle and a positive angle when constructing amain reference sample buffer according to an example of the presentdocument.

FIGS. 17 and 18 are diagrams illustrating how to perform paddingdepending on a negative angle and a positive angle when constructing amain reference sample buffer according to another example of the presentdocument.

FIG. 19 illustratively represents a content streaming system structurediagram to which the present document may be applied.

DESCRIPTION OF EMBODIMENTS

An exemplary embodiment of the present disclosure provides an imageinformation decoding method performed by a decoding apparatus. Themethod includes: decoding a non-separable secondary transform (NSST)index from a bitstream, if an NSST is applied to a target block,decoding information about transform coefficients for the target blockfrom the bitstream, based on the decoded NSST index, and deriving thetransform coefficients for the target block based on the decodedinformation about the transform coefficients, in which the NSST index isdecoded prior to the information about the transform coefficients forthe target block.

The present disclosure may be modified in various forms, and specificembodiments thereof will be described and illustrated in the drawings.However, the embodiments are not intended for limiting the disclosure.The terms used in the following description are used to merely describespecific embodiments, but are not intended to limit the disclosure. Anexpression of a singular number includes an expression of the pluralnumber, so long as it is clearly read differently. The terms such as“include” and “have” are intended to indicate that features, numbers,steps, operations, elements, components, or combinations thereof used inthe following description exist and it should be thus understood thatthe possibility of existence or addition of one or more differentfeatures, numbers, steps, operations, elements, components, orcombinations thereof is not excluded.

Hereinafter, examples of the present embodiment will be described indetail with reference to the accompanying drawings. In addition, likereference numerals are used to indicate like elements throughout thedrawings, and the same descriptions on the like elements will beomitted.

FIG. 1 illustrates an example of a video/image coding system to whichthe present disclosure may be applied.

Referring to FIG. 1, a video/image coding system may include a sourcedevice and a reception device. The source device may transmit encodedvideo/image information or data to the reception device through adigital storage medium or network in the form of a file or streaming.

The source device may include a video source, an encoding apparatus, anda transmitter. The receiving device may include a receiver, a decodingapparatus, and a renderer. The encoding apparatus may be called avideo/image encoding apparatus, and the decoding apparatus may be calleda video/image decoding apparatus. The transmitter may be included in theencoding apparatus. The receiver may be included in the decodingapparatus. The renderer may include a display, and the display may beconfigured as a separate device or an external component.

The video source may acquire video/image through a process of capturing,synthesizing, or generating the video/image. The video source mayinclude a video/image capture device and/or a video/image generatingdevice. The video/image capture device may include, for example, one ormore cameras, video/image archives including previously capturedvideo/images, and the like. The video/image generating device mayinclude, for example, computers, tablets and smartphones, and may(electronically) generate video/images. For example, a virtualvideo/image may be generated through a computer or the like. In thiscase, the video/image capturing process may be replaced by a process ofgenerating related data.

The encoding apparatus may encode input video/image. The encodingapparatus may perform a series of procedures such as prediction,transform, and quantization for compaction and coding efficiency. Theencoded data (encoded video/image information) may be output in the formof a bitstream.

The transmitter may transmit the encoded image/image information or dataoutput in the form of a bitstream to the receiver of the receivingdevice through a digital storage medium or a network in the form of afile or streaming. The digital storage medium may include variousstorage mediums such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, and thelike. The transmitter may include an element for generating a media filethrough a predetermined file format and may include an element fortransmission through a broadcast/communication network. The receiver mayreceive/extract the bitstream and transmit the received bitstream to thedecoding apparatus.

The decoding apparatus may decode the video/image by performing a seriesof procedures such as dequantization, inverse transform, and predictioncorresponding to the operation of the encoding apparatus.

The renderer may render the decoded video/image. The renderedvideo/image may be displayed through the display.

This document relates to video/image coding. For example, amethod/embodiment disclosed in this document may be applied to a methoddisclosed in the versatile video coding (VVC) standard, the essentialvideo coding (EVC) standard, the AOMedia Video 1 (AV1) standard, the 2ndgeneration of audio video coding standard (AVS2) or the next generationvideo/image coding standard (e.g., H.267, H.268, or the like).

This document suggests various embodiments of video/image coding, andthe above embodiments may also be performed in combination with eachother unless otherwise specified.

In this document, a video may refer to a series of images over time. Apicture generally refers to the unit representing one image at aparticular time frame, and a slice/tile refers to the unit constitutinga part of the picture in terms of coding. A slice/tile may include oneor more coding tree units (CTUs). One picture may consist of one or moreslices/tiles. One picture may consist of one or more tile groups. Onetile group may include one or more tiles. A brick may represent arectangular region of CTU rows within a tile in a picture (a brick mayrepresent a rectangular region of CTU rows within a tile in a picture).A tile may be partitioned into a multiple bricks, each of which may beconstructed with one or more CTU rows within the tile (A tile may bepartitioned into multiple bricks, each of which consisting of one ormore CTU rows within the tile). A tile that is not partitioned intomultiple bricks may also be referred to as a brick. A brick scan mayrepresent a specific sequential ordering of CTUs partitioning a picture,wherein the CTUs may be ordered in a CTU raster scan within a brick, andbricks within a tile may be ordered consecutively in a raster scan ofthe bricks of the tile, and tiles in a picture may be orderedconsecutively in a raster scan of the tiles of the picture (A brick scanis a specific sequential ordering of CTUs partitioning a picture inwhich the CTUs are ordered consecutively in CTU raster scan in a brick,bricks within a tile are ordered consecutively in a raster scan of thebricks of the tile, and tiles in a picture are ordered consecutively ina raster scan of the tiles of the picture). A tile is a particular tilecolumn and a rectangular region of CTUs within a particular tile column(A tile is a rectangular region of CTUs within a particular tile columnand a particular tile row in a picture). The tile column is arectangular region of CTUs, which has a height equal to the height ofthe picture and a width that may be specified by syntax elements in thepicture parameter set (The tile column is a rectangular region of CTUshaving a height equal to the height of the picture and a width specifiedby syntax elements in the picture parameter set). The tile row is arectangular region of CTUs, which has a width specified by syntaxelements in the picture parameter set and a height that may be equal tothe height of the picture (The tile row is a rectangular region of CTUshaving a height specified by syntax elements in the picture parameterset and a width equal to the width of the picture). A tile scan mayrepresent a specific sequential ordering of CTUs partitioning a picture,and the CTUs may be ordered consecutively in a CTU raster scan in atile, and tiles in a picture may be ordered consecutively in a rasterscan of the tiles of the picture (A tile scan is a specific sequentialordering of CTUs partitioning a picture in which the CTUs are orderedconsecutively in CTU raster scan in a tile whereas tiles in a pictureare ordered consecutively in a raster scan of the tiles of the picture).A slice may include an integer number of bricks of a picture, and theinteger number of bricks may be included in a single NAL unit (A sliceincludes an integer number of bricks of a picture that may beexclusively contained in a single NAL unit). A slice may be constructedwith multiple complete tiles, or may be a consecutive sequence ofcomplete bricks of one tile (A slice may consists of either a number ofcomplete tiles or only a consecutive sequence of complete bricks of onetile). In this document, a tile group and a slice may be used in placeof each other. For example, in this document, a tile group/tile groupheader may be referred to as a slice/slice header.

A pixel or a pel may mean a smallest unit constituting one picture (orimage). Also, ‘sample’ may be used as a term corresponding to a pixel. Asample may generally represent a pixel or a value of a pixel, and mayrepresent only a pixel/pixel value of a luma component or only apixel/pixel value of a chroma component.

A unit may represent a basic unit of image processing. The unit mayinclude at least one of a specific region of the picture and informationrelated to the region. One unit may include one luma block and twochroma (ex. cb, cr) blocks. The unit may be used interchangeably withterms such as block or area in some cases. In a general case, an M×Nblock may include samples (or sample arrays) or a set (or array) oftransform coefficients of M columns and N rows.

In this document, the symbol “/” and “,” should be interpreted as“and/or.” For example, the expression “A/B” is interpreted as “A and/orB”, and the expression “A, B” is interpreted as “A and/or B.”Additionally, the expression “A/B/C” means “at least one of A, B, and/orC.” Further, the expression “A, B, C” also means “at least one of A, B,and/or C.” (In this document, the term “/” and “,” should be interpretedto indicate “and/or.” For instance, the expression “A/B” may mean “Aand/or B.” Further, “A, B” may mean “A and/or B.” Further, “A/B/C” maymean “at least one of A, B, and/or C.” Also, “A/B/C” may mean “at leastone of A, B, and/or C.”)

Additionally, in the present document, the term “or” should beinterpreted as “and/or.” For example, the expression “A or B” maymean 1) only “A”, 2) only “B”, and/or 3) “both A and B.” In other words,the term “or” in the present document may mean “additionally oralternatively.” (Further, in the document, the term “or” should beinterpreted to indicate “and/or.” For instance, the expression “A or B”may comprise 1) only A, 2) only B, and/or 3) both A and B. In otherwords, the term “or” in this document should be interpreted to indicate“additionally or alternatively.”)

FIG. 2 is a diagram schematically illustrating a configuration of avideo/image encoding apparatus to which the present document may beapplied. Hereinafter, what is referred to as the video encodingapparatus may include an image encoding apparatus.

Referring to FIG. 2, the encoding apparatus 200 may include and beconfigured with an image partitioner 210, a predictor 220, a residualprocessor 230, an entropy encoder 240, an adder 250, a filter 260, and amemory 270. The predictor 220 may include an inter predictor 221 and anintra predictor 222. The residual processor 230 may include atransformer 232, a quantizer 233, a dequantizer 234, and an inversetransformer 235. The residual processor 230 may further include asubtractor 231. The adder 250 may be called a reconstructor orreconstructed block generator. The image partitioner 210, the predictor220, the residual processor 230, the entropy encoder 240, the adder 250,and the filter 260, which have been described above, may be configuredby one or more hardware components (e.g., encoder chipsets orprocessors) according to an embodiment. In addition, the memory 270 mayinclude a decoded picture buffer (DPB), and may also be configured by adigital storage medium. The hardware component may further include thememory 270 as an internal/external component.

The image partitioner 210 may split an input image (or, picture, frame)input to the encoding apparatus 200 into one or more processing units.As an example, the processing unit may be called a coding unit (CU). Inthis case, the coding unit may be recursively split according to aQuad-tree binary-tree ternary-tree (QTBTTT) structure from a coding treeunit (CTU) or the largest coding unit (LCU). For example, one codingunit may be split into a plurality of coding units of a deeper depthbased on a quad-tree structure, a binary-tree structure, and/or aternary-tree structure. In this case, for example, the quad-treestructure is first applied and the binary-tree structure and/or theternary-tree structure may be later applied. Alternatively, thebinary-tree structure may also be first applied. A coding procedureaccording to the present disclosure may be performed based on a finalcoding unit which is not split any more. In this case, based on codingefficiency according to image characteristics or the like, the maximumcoding unit may be directly used as the final coding unit, or asnecessary, the coding unit may be recursively split into coding units ofa deeper depth, such that a coding unit having an optimal size may beused as the final coding unit. Here, the coding procedure may include aprocedure such as prediction, transform, and reconstruction to bedescribed later. As another example, the processing unit may furtherinclude a prediction unit (PU) or a transform unit (TU). In this case,each of the prediction unit and the transform unit may be split orpartitioned from the aforementioned final coding unit. The predictionunit may be a unit of sample prediction, and the transform unit may be aunit for inducing a transform coefficient and/or a unit for inducing aresidual signal from the transform coefficient.

The unit may be interchangeably used with the term such as a block or anarea in some cases. Generally, an M×N block may represent samplescomposed of M columns and N rows or a group of transform coefficients.The sample may generally represent a pixel or a value of the pixel, andmay also represent only the pixel/pixel value of a luma component, andalso represent only the pixel/pixel value of a chroma component. Thesample may be used as the term corresponding to a pixel or a pelconfiguring one picture (or image).

The encoding apparatus 200 may generate a residual signal (residualblock, residual sample array) by subtracting a predicted signal(predicted block, prediction sample array) output from the interpredictor 221 or the intra predictor 222 from the input image signal(original block, original sample array), and the generated residualsignal is transmitted to the transformer 232. In this case, asillustrated, the unit for subtracting the predicted signal (predictedblock, prediction sample array) from the input image signal (originalblock, original sample array) within an encoder 200 may be called thesubtractor 231. The predictor may perform prediction for a block to beprocessed (hereinafter, referred to as a current block), and generate apredicted block including prediction samples of the current block. Thepredictor may determine whether intra prediction is applied or interprediction is applied in units of the current block or the CU. Thepredictor may generate various information about prediction, such asprediction mode information, to transfer the generated information tothe entropy encoder 240 as described later in the description of eachprediction mode. The information about prediction may be encoded by theentropy encoder 240 to be output in a form of the bitstream.

The intra predictor 222 may predict a current block with reference tosamples within a current picture. The referenced samples may be locatedneighboring to the current block, or may also be located away from thecurrent block according to the prediction mode. The prediction modes inthe intra prediction may include a plurality of non-directional modesand a plurality of directional modes. The non-directional mode mayinclude, for example, a DC mode or a planar mode. The directional modemay include, for example, 33 directional prediction modes or 65directional prediction modes according to the fine degree of theprediction direction. However, this is illustrative and the directionalprediction modes which are more or less than the above number may beused according to the setting. The intra predictor 222 may alsodetermine the prediction mode applied to the current block using theprediction mode applied to the neighboring block.

The inter predictor 221 may induce a predicted block of the currentblock based on a reference block (reference sample array) specified by amotion vector on a reference picture. At this time, in order to decreasethe amount of motion information transmitted in the inter predictionmode, the motion information may be predicted in units of a block, asub-block, or a sample based on the correlation of the motioninformation between the neighboring block and the current block. Themotion information may include a motion vector and a reference pictureindex. The motion information may further include inter predictiondirection (L0 prediction, L1 prediction, Bi prediction, or the like)information. In the case of the inter prediction, the neighboring blockmay include a spatial neighboring block existing within the currentpicture and a temporal neighboring block existing in the referencepicture. The reference picture including the reference block and thereference picture including the temporal neighboring block may also bethe same as each other, and may also be different from each other. Thetemporal neighboring block may be called the name such as a collocatedreference block, a collocated CU (colCU), or the like, and the referencepicture including the temporal neighboring block may also be called acollocated picture (colPic). For example, the inter predictor 221 mayconfigure a motion information candidate list based on the neighboringblocks, and generate information indicating what candidate is used toderive the motion vector and/or the reference picture index of thecurrent block. The inter prediction may be performed based on variousprediction modes, and for example, in the case of a skip mode and amerge mode, the inter predictor 221 may use the motion information ofthe neighboring block as the motion information of the current block. Inthe case of the skip mode, the residual signal may not be transmittedunlike the merge mode. A motion vector prediction (MVP) mode mayindicate the motion vector of the current block by using the motionvector of the neighboring block as a motion vector predictor, andsignaling a motion vector difference.

The predictor 200 may generate a predicted signal based on variousprediction methods to be described later. For example, the predictor maynot only apply the intra prediction or the inter prediction forpredicting one block, but also simultaneously apply the intra predictionand the inter prediction. This may be called a combined inter and intraprediction (CIIP). Further, the predictor may be based on an intra blockcopy (IBC) prediction mode, or a palette mode in order to performprediction on a block. The IBC prediction mode or palette mode may beused for content image/video coding of a game or the like, such asscreen content coding (SCC). The IBC basically performs prediction in acurrent picture, but it may be performed similarly to inter predictionin that it derives a reference block in a current picture. That is, theIBC may use at least one of inter prediction techniques described in thepresent document. The palette mode may be regarded as an example ofintra coding or intra prediction. When the palette mode is applied, asample value in a picture may be signaled based on information on apalette index and a palette table.

The predicted signal generated through the predictor (including theinter predictor 221 and/or the intra predictor 222) may be used togenerate a reconstructed signal or used to generate a residual signal.The transformer 232 may generate transform coefficients by applying thetransform technique to the residual signal. For example, the transformtechnique may include at least one of a discrete cosine transform (DCT),a discrete sine transform (DST), a Karhunen-Loève transform (KLT), agraph-based transform (GBT), or a conditionally non-linear transform(CNT). Here, when the relationship information between pixels isillustrated as a graph, the GBT means the transform obtained from thegraph. The CNT means the transform which is acquired based on apredicted signal generated by using all previously reconstructed pixels.In addition, the transform process may also be applied to a pixel blockhaving the same size of the square, and may also be applied to the blockhaving a variable size rather than the square.

The quantizer 233 may quantize the transform coefficients to transmitthe quantized transform coefficients to the entropy encoder 240, and theentropy encoder 240 may encode the quantized signal (information aboutthe quantized transform coefficients) to the encoded quantized signal tothe bitstream. The information about the quantized transformcoefficients may be called residual information. The quantizer 233 mayrearrange the quantized transform coefficients having a block form in aone-dimensional vector form based on a coefficient scan order, and alsogenerate the information about the quantized transform coefficientsbased on the quantized transform coefficients of the one dimensionalvector form. The entropy encoder 240 may perform various encodingmethods, for example, such as an exponential Golomb coding, acontext-adaptive variable length coding (CAVLC), and a context-adaptivebinary arithmetic coding (CABAC). The entropy encoder 240 may alsoencode information (e.g., values of syntax elements and the like)necessary for reconstructing video/image other than the quantizedtransform coefficients together or separately. The encoded information(e.g., encoded video/image information) may be transmitted or stored inunits of network abstraction layer (NAL) unit in a form of thebitstream. The video/image information may further include informationabout various parameter sets such as an adaptation parameter set (APS),a picture parameter set (PPS), a sequence parameter set (SPS), or avideo parameter set (VPS). In addition, the video/image information mayfurther include general constraint information. The signaled/transmittedinformation and/or syntax elements to be described later in thisdocument may be encoded through the aforementioned encoding procedureand thus included in the bitstream. The bitstream may be transmittedthrough a network, or stored in a digital storage medium. Here, thenetwork may include a broadcasting network and/or a communicationnetwork, or the like, and the digital storage medium may include variousstorage media such as USB, SD, CD, DVD, Blue-ray, HDD, and SSD. Atransmitter (not illustrated) for transmitting the signal output fromthe entropy encoder 240 and/or a storage (not illustrated) for storingthe signal may be configured as the internal/external elements of theencoding apparatus 200, or the transmitter may also be included in theentropy encoder 240.

The quantized transform coefficients output from the quantizer 233 maybe used to generate a predicted signal. For example, the dequantizer 234and the inverse transformer 235 apply dequantization and inversetransform to the quantized transform coefficients, such that theresidual signal (residual block or residual samples) may bereconstructed. The adder 250 adds the reconstructed residual signal tothe predicted signal output from the inter predictor 221 or the intrapredictor 222, such that the reconstructed signal (reconstructedpicture, reconstructed block, reconstructed sample array) may begenerated. As in the case where the skip mode is applied, if there is noresidual for the block to be processed, the predicted block may be usedas the reconstructed block. The adder 250 may be called a reconstructoror a reconstructed block generator. The generated reconstructed signalmay be used for the intra prediction of the next block to be processedwithin the current picture, and as described later, also used for theinter prediction of the next picture through filtering.

Meanwhile, a luma mapping with chroma scaling (LMCS) may also be appliedin a picture encoding and/or reconstruction process.

The filter 260 may apply filtering to the reconstructed signal, therebyimproving subjective/objective image qualities. For example, the filter260 may apply various filtering methods to the reconstructed picture togenerate a modified reconstructed picture, and store the modifiedreconstructed picture in the memory 270, specifically, the DPB of thememory 270. Various filtering methods may include, for example, adeblocking filtering, a sample adaptive offset, an adaptive loop filter,a bilateral filter, and the like. The filter 260 may generate variousfiltering-related information to transfer the generated information tothe entropy encoder 240, as described later in the description of eachfiltering method. The filtering-related information may be encoded bythe entropy encoder 240 to be output in a form of the bitstream.

The modified reconstructed picture transmitted to the memory 270 may beused as the reference picture in the inter predictor 221. If the interprediction is applied by the inter predictor, the encoding apparatus mayavoid the prediction mismatch between the encoding apparatus 200 and thedecoding apparatus, and also improve coding efficiency.

The DPB of the memory 270 may store the modified reconstructed pictureto be used as the reference picture in the inter predictor 221. Thememory 270 may store motion information of the block in which the motioninformation within the current picture is derived (or encoded) and/ormotion information of the blocks within the previously reconstructedpicture. The stored motion information may be transferred to the interpredictor 221 to be utilized as motion information of the spatialneighboring block or motion information of the temporal neighboringblock. The memory 270 may store the reconstructed samples of thereconstructed blocks within the current picture, and transfer thereconstructed samples to the intra predictor 222.

FIG. 3 is a diagram for schematically explaining a configuration of avideo/image decoding apparatus to which the present disclosure isapplicable.

Referring to FIG. 3, the decoding apparatus 300 may include andconfigured with an entropy decoder 310, a residual processor 320, apredictor 330, an adder 340, a filter 350, and a memory 360. Thepredictor 330 may include an inter predictor 331 and an intra predictor332. The residual processor 320 may include a dequantizer 321 and aninverse transformer 322. The entropy decoder 310, the residual processor320, the predictor 330, the adder 340, and the filter 350, which havebeen described above, may be configured by one or more hardwarecomponents (e.g., decoder chipsets or processors) according to anembodiment. Further, the memory 360 may include a decoded picture buffer(DPB), and may be configured by a digital storage medium. The hardwarecomponent may further include the memory 360 as an internal/externalcomponent.

When the bitstream including the video/image information is input, thedecoding apparatus 300 may reconstruct the image in response to aprocess in which the video/image information is processed in theencoding apparatus illustrated in FIG. 2. For example, the decodingapparatus 300 may derive the units/blocks based on block split-relatedinformation acquired from the bitstream. The decoding apparatus 300 mayperform decoding using the processing unit applied to the encodingapparatus. Therefore, the processing unit for the decoding may be, forexample, a coding unit, and the coding unit may be split according tothe quad-tree structure, the binary-tree structure, and/or theternary-tree structure from the coding tree unit or the maximum codingunit. One or more transform units may be derived from the coding unit.In addition, the reconstructed image signal decoded and output throughthe decoding apparatus 300 may be reproduced through a reproducingapparatus.

The decoding apparatus 300 may receive the signal output from theencoding apparatus illustrated in FIG. 2 in a form of the bitstream, andthe received signal may be decoded through the entropy decoder 310. Forexample, the entropy decoder 310 may derive information (e.g.,video/image information) necessary for the image reconstruction (orpicture reconstruction) by parsing the bitstream. The video/imageinformation may further include information about various parameter setssuch as an adaptation parameter set (APS), a picture parameter set(PPS), a sequence parameter set (SPS), and a video parameter set (VPS).In addition, the video/image information may further include generalconstraint information. The decoding apparatus may decode the picturefurther based on the information about the parameter set and/or thegeneral constraint information. The signaled/received information and/orsyntax elements to be described later in this document may be decodedthrough the decoding procedure and acquired from the bitstream. Forexample, the entropy decoder 310 may decode information within thebitstream based on a coding method such as an exponential Golomb coding,a CAVLC, or a CABAC, and output a value of the syntax element necessaryfor the image reconstruction, and the quantized values of theresidual-related transform coefficient. More specifically, the CABACentropy decoding method may receive a bin corresponding to each syntaxelement from the bitstream, determine a context model using syntaxelement information to be decoded and decoding information of theneighboring block and the block to be decoded or information of thesymbol/bin decoded in the previous stage, and generate a symbolcorresponding to a value of each syntax element by predicting theprobability of generation of the bin according to the determined contextmodel to perform the arithmetic decoding of the bin. At this time, theCABAC entropy decoding method may determine the context model and thenupdate the context model using the information of the decoded symbol/binfor a context model of a next symbol/bin. The information aboutprediction among the information decoded by the entropy decoder 310 maybe provided to the predictor (the inter predictor 332 and the intrapredictor 331), and a residual value at which the entropy decoding isperformed by the entropy decoder 310, that is, the quantized transformcoefficients and the related parameter information may be input to theresidual processor 320. The residual processor 320 may derive a residualsignal (residual block, residual samples, residual sample array). Inaddition, the information about filtering among the information decodedby the entropy decoder 310 may be provided to the filter 350. Meanwhile,a receiver (not illustrated) for receiving the signal output from theencoding apparatus may be further configured as the internal/externalelement of the decoding apparatus 300, or the receiver may also be acomponent of the entropy decoder 310. Meanwhile, the decoding apparatusaccording to this document may be called a video/image/picture decodingapparatus, and the decoding apparatus may also be classified into aninformation decoder (video/image/picture information decoder) and asample decoder (video/image/picture sample decoder). The informationdecoder may include the entropy decoder 310, and the sample decoder mayinclude at least one of the dequantizer 321, the inverse transformer322, the adder 340, the filter 350, the memory 360, the inter predictor332, and the intra predictor 331.

The dequantizer 321 may dequantize the quantized transform coefficientsto output the transform coefficients. The dequantizer 321 may rearrangethe quantized transform coefficients in a two-dimensional block form. Inthis case, the rearrangement may be performed based on a coefficientscan order performed by the encoding apparatus. The dequantizer 321 mayperform dequantization for the quantized transform coefficients using aquantization parameter (e.g., quantization step size information), andacquire the transform coefficients.

The inverse transformer 322 inversely transforms the transformcoefficients to acquire the residual signal (residual block, residualsample array).

The predictor 330 may perform the prediction of the current block, andgenerate a predicted block including the prediction samples of thecurrent block. The predictor may determine whether the intra predictionis applied or the inter prediction is applied to the current block basedon the information about prediction output from the entropy decoder 310,and determine a specific intra/inter prediction mode.

The predictor may generate the predicted signal based on variousprediction methods to be described later. For example, the predictor maynot only apply the intra prediction or the inter prediction for theprediction of one block, but also apply the intra prediction and theinter prediction at the same time. This may be called a combined interand intra prediction (CIIP). Further, the predictor may be based on anintra block copy (IBC) prediction mode, or a palette mode in order toperform prediction on a block. The IBC prediction mode or palette modemay be used for content image/video coding of a game or the like, suchas screen content coding (SCC). The IBC basically performs prediction ina current picture, but it may be performed similarly to inter predictionin that it derives a reference block in a current picture. That is, theIBC may use at least one of inter prediction techniques described in thepresent document. The palette mode may be regarded as an example ofintra coding or intra prediction. When the palette mode is applied,information on a palette table and a palette index may be included inthe video/image information and signaled.

The intra predictor 331 may predict the current block with reference tothe samples within the current picture. The referenced samples may belocated neighboring to the current block according to the predictionmode, or may also be located away from the current block. The predictionmodes in the intra prediction may include a plurality of non-directionalmodes and a plurality of directional modes. The intra predictor 331 mayalso determine the prediction mode applied to the current block usingthe prediction mode applied to the neighboring block.

The inter predictor 332 may induce the predicted block of the currentblock based on the reference block (reference sample array) specified bythe motion vector on the reference picture. At this time, in order todecrease the amount of the motion information transmitted in the interprediction mode, the motion information may be predicted in units of ablock, a sub-block, or a sample based on the correlation of the motioninformation between the neighboring block and the current block. Themotion information may include a motion vector and a reference pictureindex. The motion information may further include inter predictiondirection (L0 prediction, L1 prediction, Bi prediction, or the like)information. In the case of the inter prediction, the neighboring blockmay include a spatial neighboring block existing within the currentpicture and a temporal neighboring block existing in the referencepicture. For example, the inter predictor 332 may configure a motioninformation candidate list based on the neighboring blocks, and derivethe motion vector and/or the reference picture index of the currentblock based on received candidate selection information. The interprediction may be performed based on various prediction modes, and theinformation about the prediction may include information indicating themode of the inter prediction of the current block.

The adder 340 may add the acquired residual signal to the predictedsignal (predicted block, prediction sample array) output from thepredictor (including the inter predictor 332 and/or the intra predictor331) to generate the reconstructed signal (reconstructed picture,reconstructed block, reconstructed sample array). As in the case wherethe skip mode is applied, if there is no residual for the block to beprocessed, the predicted block may be used as the reconstructed block.

The adder 340 may be called a reconstructor or a reconstructed blockgenerator. The generated reconstructed signal may be used for the intraprediction of a next block to be processed within the current picture,and as described later, may also be output through filtering or may alsobe used for the inter prediction of a next picture.

Meanwhile, a luma mapping with chroma scaling (LMCS) may also be appliedin the picture decoding process.

The filter 350 may apply filtering to the reconstructed signal, therebyimproving the subjective/objective image qualities. For example, thefilter 350 may apply various filtering methods to the reconstructedpicture to generate a modified reconstructed picture, and transmit themodified reconstructed picture to the memory 360, specifically, the DPBof the memory 360. Various filtering methods may include, for example, adeblocking filtering, a sample adaptive offset, an adaptive loop filter,a bidirectional filter, and the like.

The (modified) reconstructed picture stored in the DPB of the memory 360may be used as the reference picture in the inter predictor 332. Thememory 360 may store motion information of the block in which the motioninformation within the current picture is derived (decoded) and/ormotion information of the blocks within the previously reconstructedpicture. The stored motion information may be transferred to the interpredictor 260 to be utilized as motion information of the spatialneighboring block or motion information of the temporal neighboringblock. The memory 360 may store the reconstructed samples of thereconstructed blocks within the current picture, and transfer the storedreconstructed samples to the intra predictor 331.

In the present specification, the exemplary embodiments described in thefilter 260, the inter predictor 221, and the intra predictor 222 of theencoding apparatus 200 may be applied equally to or to correspond to thefilter 350, the inter predictor 332, and the intra predictor 331 of thedecoding apparatus 300, respectively.

Meanwhile, as described above, in performing video coding, prediction isperformed to improve compression efficiency. Through this, a predictedblock including prediction samples for a current block as a block to becoded (i.e., a coding target block) may be generated. Here, thepredicted block includes prediction samples in a spatial domain (orpixel domain). The predicted block is derived in the same manner in anencoding apparatus and a decoding apparatus, and the encoding apparatusmay signal information (residual information) on residual between theoriginal block and the predicted block, rather than an original samplevalue of an original block, to the decoding apparatus, therebyincreasing image coding efficiency. The decoding apparatus may derive aresidual block including residual samples based on the residualinformation, add the residual block and the predicted block to generatereconstructed blocks including reconstructed samples, and generate areconstructed picture including the reconstructed blocks.

The residual information may be generated through a transform andquantization procedure. For example, the encoding apparatus may derive aresidual block between the original block and the predicted block,perform a transform procedure on residual samples (residual samplearray) included in the residual block to derive transform coefficients,perform a quantization procedure on the transform coefficients to derivequantized transform coefficients, and signal related residualinformation to the decoding apparatus (through a bit stream). Here, theresidual information may include value information of the quantizedtransform coefficients, location information, a transform technique, atransform kernel, a quantization parameter, and the like. The decodingapparatus may perform dequantization/inverse transform procedure basedon the residual information and derive residual samples (or residualblocks). The decoding apparatus may generate a reconstructed picturebased on the predicted block and the residual block. Also, for referencefor inter prediction of a picture afterward, the encoding apparatus mayalso dequantize/inverse-transform the quantized transform coefficientsto derive a residual block and generate a reconstructed picture basedthereon.

FIG. 4A is a diagram representing 67 intra prediction modes according toan embodiment of the present document, and FIG. 4B is a diagram furthershowing wide-angle intra prediction modes according to an embodiment ofthe present document.

In intra prediction according to an embodiment of the present document,67 intra prediction modes as shown in FIG. 4A and Table 1 may be used.

TABLE 1

(Associated (Intra prediction name)<}0{>Associated name mode)<}45{>Intraprediction mode 0 intra planar (

(INTRA_PLANAR)<}30{>INTRA_PLANAR} 1<}100{>1 intra DC (

DC (INTRA_DC)<}42{>INTRA_DC} 2 . . . 66

 66 (INTRA_ANGULAR2 . . . INTRA_ANGULAR66)<}100{>Intra angular 2 . . .intra angular 66 (INTRA_ANGULAR 2 . . . INTRA_ANGULAR 66)

This is an extension of the existing 35 angular modes to 67 angularmodes for intra-encoding and more accurate prediction of high-resolutionimage. Arrows represented by dotted lines in FIG. 4A indicate 32 newlyadded angular modes in the 35 angular modes. The intra planner(INTRA_PLANAR) mode and the intra DC (INTRA_DC) mode are the same as theexisting intra planner mode and the existing intra DC mode. The added 32angular modes may be applied to all block sizes, and may be applied toboth intra encoding and decoding of the luminance (luma) component andthe chrominance (chroma) component.

Referring to FIG. 4A, intra prediction mode 2 may represent a leftdownward diagonal direction, 34 may represent a left upward diagonaldirection, and 66 may represent a right upward diagonal direction. InFIG. 4, a vertical direction may be indicated with an intra predictionmode 50 and a horizontal direction may be indicated with an intraprediction mode 18.

FIG. 5 is a control flowchart illustrating an encoding method that maybe applied in the intra prediction according to an embodiment of thepresent document, and FIG. 8 is a control block diagram illustrating aconfiguration of an encoding apparatus that performs the intraprediction of FIG. 5.

According to FIG. 5, the encoding apparatus may derive an intraprediction mode for a current block (S500), and derive neighboringreference samples of the current block (S510).

When restoring a block to which the intra prediction has been applied,the encoding apparatus constructs a prediction block using neighboringpixels of the block. In order to generate a prediction sample of thecurrent block according to the prediction mode, neighboring pixels, thatis, reference samples, must be derived.

Assuming that the size of the current block is N, the maximum size ofthe reference pixel to which reference may be made when performing theintra prediction may be 2N pixels adjacent to the top, 2N pixelsadjacent to the left side, and a corner pixel in the top-left corner.

FIG. 6 is a diagram showing an example of a reference pixel that may beused for intra prediction.

As illustrated, when the intra prediction is performed on a 4×4 block,neighboring samples to which reference may be made are 2N(8) samplesadjacent to the top of the 4×4 block, 2N(8) samples adjacent to the leftside, and a corner sample in the top-left corner.

Reference samples to which reference is made for prediction may besubjected to smoothing processing depending on the size and sample valueof the current block. This is to prevent in advance a visual artifact ofa prediction block to be derived due to a difference between referencesamples.

The encoding apparatus generates prediction samples within the currentblock based on the intra prediction mode and the neighboring referencesamples (S520).

The method used when predicting an intra block by using referencesamples adjacent to the current block may be generally classified intotwo kinds of methods, that is, an angular prediction method in which aprediction block is constructed by copying reference samples locatedalong a specific direction, and a non-angular prediction method (DCmode, planner mode) in which as many reference pixels as can bereferenced are utilized.

The angular prediction method was devised to express the structure ofvarious directions that may appear on the screen. The angular predictionmethod may be performed by designating a specific direction as a mode asshown in FIG. 4, and then copying reference samples corresponding to theprediction mode angle into the sample to be predicted.

If it is not possible to make reference to a reference pixel of aninteger pixel unit, as shown in FIG. 7, the prediction block may beconstructed by copying a pixel which has been interpolated using adistance ratio between two corresponding pixels and two pixels obtainedby an angle.

FIG. 7 is a diagram illustrating reference pixel interpolation withrespect to a location of a fractional pixel (sub pel).

As shown, when the position of the reference sample where the predictiondirection is applied to the prediction sample P is a fractional pixel(yFrac) rather than an integer sample (yInt), a tan value for theprediction angle (θ) is required in order to obtain the position of thereference sample.

In order to calculate the position of a sub pel, that is, a fractionalpixel, Table 2 shows the tan value for the angle θ of each mode, whichhas been scaled in an integer unit for the sake of calculationconvenience. That is, Table 2 shows the approximate values of tan θ forrespective modes, and Table 3 shows the approximate values of the tan−1θfor respective modes. The intraPredAngle in Tables 2 and 3 is an anglebetween the vertical direction or the horizontal direction and thedirection of the prediction mode. As the intraPredAngle value increases,the intra prediction mode becomes closer to the diagonal direction.

TABLE 2 predModeIntra 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17intraPredAngle — 32 29 26 23 21 19 17 15 13 11 9 7 5 3 2 1 predModeIntra18 19 20 21 22 23 24 25 26 27 218 29 30 31 32 33 34 intraPredAngle 0 1 23 5 7 9 11 13 15 17 19 21 23 26 29 32 predModeIntra 35 36 37 38 39 40 4142 43 44 45 46 47 48 49 50 51 intraPredAngle 29 26 23 21 19 17 15 13 119 7 5 3 2 1 0 1 predModeIntra 52 53 54 55 56 57 58 59 60 61 62 63 64 6566 intraPredAngle 2 3 5 7 9 11 13 15 17 19 21 23 26 29 32

TABLE 3 predModeIntra 19 20 21 22 23 24 25 26 invAngle −8192 −4065 −2731−1638 −1170 −910 −745 −630 predModeIntra 27 28 29 30 31 32 33 34invAngle −546 −482 −431 −390 −356 −315 −282 −256 predModeIntra 35 36 3738 39 40 41 42 invAngle −282 −315 −256 −390 −431 −482 −546 −630predModeIntra 43 44 45 46 47 48 49 invAngle −745 −710 −1170 −1630 −2731−4096 −8192

Alternatively, as shown in FIG. 4B, when more prediction directions thanthe 66 prediction directions are applied, that is, when wide angles arefurther considered for the intra prediction, the intraPredAngle of Table2 may become like that of Table 4.

TABLE 4 predModeIntra −14 −13 −12 −11 −10 −9 −8 −7 −6 −5 −4 −3 −2 −1 2 34 intraPredAngle 512 341 256 171 128 102 86 73 64 57 51 45 39 35 32 2926 predModeIntra 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21intraPredAngle 23 20 18 16 14 12 10 8 6 4 3 2 1 0 −1 −2 −3 predModeIntra22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 intraPredAngle −4 −6−8 −10 −12 −14 −16 −18 −20 −23 −26 −29 −32 −29 −26 −23 −20 predModeIntra39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 intraPredAngle −18−16 −14 −12 −10 −8 −6 −4 −3 −2 −1 0 1 2 3 4 6 predModeIntra 56 57 58 5960 61 62 63 64 65 66 67 68 69 70 71 72 intraPredAngle 8 10 12 14 16 1820 23 26 29 32 35 39 45 51 57 64 predModeIntra 73 74 75 76 77 78 79 80intraPredAngle 73 86 102 128 171 256 341 512

In order to predict a location of a fractional sample, an interpolationfilter from integer pixels, that is, integer samples, should be used.The interpolation filter may be selectively determined depending on thesize of the current block. When the width or height of the current blockis less than or equal to 8, a cubic filter may be used, while, when thewidth or height of the current block is greater than or equal to 8, aGaussian filter may be applied.

In addition, according to an example, the angular prediction mode may beclassified into a vertical direction prediction mode if it is greaterthan or equal to the mode of no. 34 in FIG. 4, which is a reference, orinto a horizontal direction prediction mode if it is less than the modeof no. 34 in FIG. 4. In the vertical direction prediction mode, theselection of the interpolation filter may be based on the width of theblock, and in the horizontal direction prediction mode, the selection ofthe interpolation filter may be based on the height of the block.

Meanwhile, a DC mode, which is one of the non-angular modes, is a methodof constructing a prediction block with an average value of referencepixels (reference samples) adjacent to the current block. If the pixelswithin the current block are homogeneous, effective prediction can beexpected. Contrarily, when the reference pixels have different values,discontinuity may occur between the prediction block and the referencesample. In a similar situation, even when predicting with the angularprediction method, unintended visual contouring may occur, and thus, theplanar mode prediction method may be used to compensate for this. Theplanar mode prediction method is to construct the prediction block byperforming horizontal linear prediction and vertical linear predictionusing a reference pixel, and then by averaging them.

Summing up the steps of generating the intra prediction signal, that is,prediction samples with reference to FIG. 5, the encoding apparatus mayset a reference sample and interpolate, that is, smooth the referencesample value for the fractional sample in order to perform prediction,as described above with reference with FIGS. 6 and 7 (S521).

When smoothing for the reference sample is completed, that is, thefractional samples for the prediction are calculated, predictionaccording to the intra mode, that is, the prediction direction, may beperformed on the current block (S522).

In this case, the encoding apparatus may perform a prediction samplefiltering procedure (S530). The prediction sample filtering may bereferred to as post filtering. Some or all of the prediction samples maybe filtered by the prediction sample filtering procedure. In some cases,S530 procedure may be omitted.

For example, after constructing the prediction block, the encodingapparatus may perform post-processing filtering to alleviatediscontinuity between the reference sample and the block boundary forthe block predicted in the vertical direction (180 degrees), thehorizontal direction (90 degrees), and the DC modes.

The encoding apparatus generates residual samples for the current blockbased on the (filtered) prediction sample (S540).

Thereafter, the residual samples may be transformed and quantized(S550).

The encoding apparatus may encode image information including predictionmode information representing the intra prediction mode, and theresidual information on the residual samples (i.e. transformed andquantized residual samples) (S560).

The encoding apparatus may output the encoded image information in theform of a bitstream. The output bitstream may be transfer to thedecoding apparatus through a storage medium or a network.

Meanwhile, the bitstream may be transmitted to the decoding apparatusthrough a network or a (digital) storage medium. Here, the network mayinclude a broadcast network, a communication network and/or the like,and the digital storage medium may include various storage media, suchas USB, SD, CD, DVD, Blu-ray, HDD, SSD, and the like.

FIG. 8 schematically represents an encoding apparatus performing animage encoding method according to the present document. The methoddisclosed in FIG. 5 may be performed by the encoding apparatus disclosedin FIG. 8. Specifically, for example, the predictor 810 of the encodingapparatus of FIG. 5 may perform S500 to S540 of FIG. 5, and thetransformer 820 and the quantizer 830 of the encoding apparatus of FIG.8 may perform S550 of FIG. 5, and the entropy encode of the encodingapparatus (not shown) may perform S560 of FIG. 5.

For prediction of the current block, the prediction mode information, ablock size, and information on a reference sample may be input to thepredictor 810. The reference sample may be subjected to smoothing, i.e.,interpolation process for the fractional sample, and prediction andselective post-processing filtering may be performed.

FIG. 9 is a control flowchart illustrating a decoding method to whichintra prediction can be applied according to an embodiment of thepresent document.

The decoding apparatus may perform an operation corresponding to theoperation which has been performed in the encoding apparatus. Thedecoding apparatus may derive an intra prediction mode for the currentblock based on the received prediction mode information (S900).

The decoding apparatus may derive neighboring reference samples of thecurrent block (S910).

When reconstructing a block to which the intra prediction has beenapplied, the decoding apparatus constructs a prediction block usingneighboring pixels of the block, and combines it with the residualsignal transmitted from the encoding apparatus. In order to generate aprediction sample of the current block according to the prediction mode,neighboring pixels, that is, reference samples, must be derived.

For example, assuming that the size of the current block is N, themaximum size of the reference pixel to which reference may be made whenperforming the intra prediction may be 2N pixels adjacent to the top, 2Npixels adjacent to the left side, and a corner pixel in the top-leftcorner.

The decoding apparatus generates prediction samples within the currentblock based on the intra prediction mode and the neighboring referencesamples (S920).

If it is not possible to make reference to a reference pixel of aninteger pixel unit, as shown in FIG. 7, the prediction block may beconstructed by copying a pixel which has been interpolated using adistance ratio between two corresponding pixels and two pixels obtainedby an angle.

In order to predict a location of a fractional sample, an interpolationfilter from integer pixels, that is, integer samples, should be used.The interpolation filter may be selectively determined depending on thesize of the current block. When the width or height of the current blockis less than or equal to 8, a cubic filter may be used, while, when thewidth or height of the current block is greater than or equal to 8, aGaussian filter may be applied.

In addition, according to an example, the angular prediction mode may beclassified into a vertical direction prediction mode if it is greaterthan or equal to the mode of no. 34 in FIG. 4, which is a reference, orinto a horizontal direction prediction mode if it is less than the modeof no. 34 in FIG. 4. In the vertical direction prediction mode, theselection of the interpolation filter may be based on the width of theblock, and in the horizontal direction prediction mode, the selection ofthe interpolation filter may be based on the height of the block.

Meanwhile, a DC mode, which is one of the non-angular modes, is a methodof constructing a prediction block with an average value of referencepixels (reference samples) adjacent to the current block. If the pixelswithin the current block are homogeneous, effective prediction can beexpected. Contrarily, when the reference pixels have different values,discontinuity may occur between the prediction block and the referencesample. In a similar situation, even when predicting with the angularprediction method, unintended visual contouring may occur, and thus, theplanar mode prediction method may be used to compensate for this. Theplanar mode prediction method is to construct the prediction block byperforming horizontal linear prediction and vertical linear predictionusing a reference pixel, and then by averaging them.

Summing up the steps of generating the prediction samples with referenceto FIG. 9, the decoding apparatus may set a reference sample andinterpolate, that is, smooth the reference pixel for the fractionalsample in order to perform prediction, as described above with referencewith FIGS. 6 and 7 (S921).

When smoothing for the reference sample is completed, that is, thefractional samples for the prediction are calculated, predictionaccording to the intra mode, that is, the prediction direction, may beperformed on the current block (S922).

In this case, the decoding apparatus may perform a prediction samplefiltering procedure (S930).

The prediction sample filtering may be referred to as post filtering.Some or all of the prediction samples may be filtered by the predictionsample filtering procedure. In some cases, S930 procedure may beomitted.

The decoding apparatus generates the residual samples for the currentblock based on the received residual information (S940).

The decoding apparatus may generate reconstructed samples for thecurrent block based on the (filtered) prediction samples and theresidual samples, and generate a reconstructed picture based on thesereconstructed samples (S950).

FIG. 10 schematically represents a decoding apparatus performing animage decoding method according to the present document. The methoddisclosed in FIG. 9 may be performed by the decoding apparatus disclosedin FIG. 10. Specifically, for example, the predictor 1010 of thedecoding apparatus of FIG. 10 may perform S900 to S930 of FIG. 9, andthe adder 1040 of the decoding apparatus of FIG. 10 may perform S950 ofFIG. 9. Further, although not shown, the process of obtaining anddecoding image information including prediction information and/orinformation on residual of the current block through a bitstream may beperformed by an entropy decoder of the decoding apparatus, and theprocess of deriving the residual sample for the current block based onthe residual information (S740) may be performed by an dequantizer 1020and an inverse transformer 1030 of the decoding apparatus of FIG. 10.

Meanwhile, hereinafter, in an embodiment of the document, based on theintra prediction method described with reference to FIGS. 4 to 10, amethod of variably selecting an interpolation filter depending on thesize and/or prediction mode of a target block to be predicted, that is,a current block is proposed.

As mentioned above, the distance between the reference sample and theprediction sample is determined depending on the prediction angle, thatis, the slope of the prediction mode. As the prediction sample withinthe current block is located further toward the bottom-right direction,the distance between the prediction sample and the reference sampleincreases, while, as the intraPredAngle value defined in Table 2increases, the slope of the prediction mode becomes closer to 45 degree,and the distance from the reference sample further increases. Also,since the distance between the reference sample and the predictionsample may also be determined by the size of the current block, the sizeof the block is also closely related to the accuracy of prediction.

In addition, when the value of intraPredAngle is greater than 0 and lessthan 32, prediction is performed from the position of a sub pel, thatis, a fractional sample, as shown in FIG. 7. In this regard, since onlypixel values at integer positions exist, the position of the fractionalsample is first predicted using the interpolation filter, and then thepredicted fractional sample value is copied to the prediction sample.Therefore, the accuracy of the prediction block may depend on theaccuracy of the interpolation filter. Alternatively, in a case where awide angle is applied and the intraPredAngle value is applied to Table4, if the intraPredAngle is equal to or greater than 32, and is not amultiple of 32, prediction may be performed from the position of thefractional sample. In addition, when a Gaussian filter is applied as aninterpolation filter, filter coefficients (filter coefficients atinteger sample positions) may be interpolated even in integer samples.

However, during the intra prediction, information that may be used asthe reference sample (reference sample value) is very limited to alreadyreconstructed samples on the left side and top, as shown in FIG. 6, andthe degree of correlation may rapidly decrease depending on the distancefrom the prediction sample. Therefore, it is effective to use theinterpolation filter with a low-pass filter effect so that artifacts ornoises of the reference sample are not propagated to the position of theprediction sample that is far from the reference sample, and conversely,if the distance between the reference sample and the prediction sampleis close to each other, the correlation is high, and therefore, it maybe advantageous to improvement of the prediction performance toconstruct a prediction block through accurate interpolation so as tomaintain similarity as high as possible.

Therefore, the present embodiment proposes a method of selecting aninterpolation filter as below.

1) Selecting an interpolation filter under the consideration of only thesize of the current prediction block

2) Selecting an interpolation filter under the consideration of only theprediction mode applied to the current block

3) Selecting an interpolation filter considering the combination, i.e.,both of the size of the current block and the prediction mode of thecurrent block

As an example, in a case where the intra prediction is performed on a4×4 block, since the prediction samples within the current block havinga block size of 4×4 exhibit a very high correlation with neighboringreference samples, a sophisticated interpolation filter may be usedregardless of the prediction mode. That is, the interpolation filter maybe selected under the consideration of only the size of the currentblock.

Alternatively, as an example, in the case of the prediction mode havingan intraPredAngle value of 11 or greater in Table 2, which has beenderived from the prediction mode of the current block regardless of thecurrent block size, the interpolation filter with a low-pass filtereffect may be used because the distance from the reference sample isincreased. That is, the interpolation filter may be selected under theconsideration of the prediction mode applied to the current block.

Alternatively, as another example, when the size of the current block isless than the predetermined block size, and the intraPredAngle value forthe prediction mode is less than a specific value, a sophisticatedinterpolation filter is used, and otherwise an interpolation filter witha low-pass filter effect may be used. That is, when selecting theinterpolation filter, both the size of the current block and thedirection of the prediction mode may be considered. For example, theprediction angle between the direction of the prediction mode of thecurrent block and the vertical direction or the horizontal direction maybe compared with a predetermined threshold value, and the interpolationfilter may be derived as either a first interpolation filter or saidsecond interpolation filter depending on the comparison result of theprediction angle and the threshold value.

Alternatively, the reference of an intraPredAngle value for a predictionmode for selecting an interpolation filter in response to the size ofthe current block may be differently applied. That is, the thresholdvalue may be set differently depending on the size of the current block.

Alternatively, it may be determined whether to apply the size of thecurrent block to selecting an interpolation filter depending on the modeof the current block. For example, if the mode of the current block is apredetermined specific mode, the first interpolation filter may beselected, while, if the mode of the current block is not a predeterminedmode, it may be determined whether to apply the first interpolationfilter or the second interpolation filter by reconsidering the size ofthe current block. In this case, the predetermined mode may be aprediction mode indicating a diagonal direction, for example, predictionmode 2, 34, or 66.

Additionally, according to another example, when the prediction mode ofthe current block is derived as MPM, and is not the planar mode or DCmode, but the angular mode, the MPM mode for the current block and theinterpolation filter used for the current block may be derived together.That is, the interpolation filter may be derived together with the MPMmode.

Additionally, when selecting the interpolation filter under theconsideration of the prediction mode, a limitation on the predictionmode may be variable depending on the size of the current block and/orthe shape of the current block. For example, in a case where the size ofthe current block as the reference is 8, when the intraPredAngle valueis less than or equal to 11, the sophisticated interpolation filter maybe used. Alternatively, in a case where the size of the current block is16 or more, when the intraPredAngle value is less than or equal to 5with the intraPredAngle value of 5 as a reference value, thesophisticated interpolation filter is used.

According to an embodiment of the present document, a spline filter or acubic filter may be used as the above-described sophisticatedinterpolation filter. In addition, as an interpolation filter with alow-pass filter effect, the linear filter or the Gaussian filter may beused.

FIG. 11 is a control flowchart illustrating an intra prediction methodaccording to an embodiment of the present document. Referring to FIG.11, the intra prediction method using the reference filter describedabove is summarized as below. FIG. 11 may be performed by theabove-described predictor of the encoding apparatus and the decodingapparatus.

First, the predictor may determine whether the intra prediction mode ofthe current block is an angle prediction mode, that is, an angularprediction mode (S1100).

As a result of the determination, if the intra prediction mode of thecurrent block is the angular mode, it may be determined whether the sizeof the current block is less than a predetermined first threshold value(S1110).

In contrast, as a result of the determination, if the intra predictionmode of the current block is not the angular mode but the non-angularmode, that is, the planar mode or the DC mode, the predictor may performintra prediction on the current block based on the reference samples(S1150).

Meanwhile, if the size of the current block is less than a predeterminedthreshold value, it may be determined whether a value indicating aprediction direction for the current block, that is, the intraPredAnglevalue of Table 2 is less than a predetermined second threshold value(S1120).

If the size of the current block is less than the predetermined firstthreshold value, a sophisticated interpolation filter, for example, acubic filter, may be used as a filter for interpolating the referencesample of the current block (S1130).

On the other hand, if the size of the current block is equal to orgreater than the first threshold (S1110), and the intraPredAngle valueis equal to or greater than the second threshold (S1120), the predictormay use a low-pass filter, e.g., a Gaussian filter, to interpolate thereference sample (S1140).

The determining steps depending on the first threshold value and thesecond threshold value of FIG. 11 are exemplary, and in S1110, it may bedetermined whether the size of the current block is less than or equalto the first threshold value, rather than whether it is less than thefirst threshold value, and In S1120, it may be determined whether theintraPredAngle value is less than or equal to the second thresholdvalue, rather than whether it is less than the second threshold value.

When the filter for interpolating the reference sample is derived, thepredictor may derive a prediction sample for the current block byperforming intra prediction on the current block (S1150).

Alternatively, according to another embodiment of the present document,based on the intra prediction method described with reference to FIGS. 4to 10, a method of variably selecting an interpolation filter dependingon the size and/or prediction mode of a target block to be predicted,that is, a current block, is proposed.

As mentioned above, the distance between the reference sample and theprediction sample is determined depending on the prediction angle, thatis, the slope of the prediction mode. As the prediction sample withinthe current block is located further toward the bottom-right direction,the distance between the prediction sample and the reference sampleincreases, while, as the intraPredAngle value defined in Table 2increases, the slope of the prediction mode becomes closer to 45 degree,and the distance from the reference sample further increases. Also,since the distance between the reference sample and the predictionsample may also be determined by the size of the current block, the sizeof the block is also closely related to the accuracy of prediction.

In addition, when the value of intraPredAngle is greater than 0 and lessthan 32, prediction is performed from the position of a sub pel, thatis, a fractional sample, as shown in FIG. 7. In this regard, since onlypixel values at integer positions exist, the position of the fractionalsample is first predicted using the interpolation filter, and then thepredicted fractional sample value is copied to the prediction sample.Therefore, the accuracy of the prediction block may depend on theaccuracy of the interpolation filter. Alternatively, in a case where awide angle is applied and the intraPredAngle value is applied to Table4, if the intraPredAngle is equal to or greater than 32, and is not amultiple of 32, prediction may be performed from the position of thefractional sample. In addition, when a Gaussian filter is applied as aninterpolation filter, filter coefficients (filter coefficients atinteger sample positions) may be interpolated even in integer samples.

However, during the intra prediction, information that may be used asthe reference sample (reference sample value) is very limited to alreadyreconstructed samples on the left side and top, as shown in FIG. 6, andthe degree of correlation may rapidly decrease depending on the distancefrom the prediction sample. Therefore, it is effective to use theinterpolation filter with a low-pass filter effect so that artifacts ornoises of the reference sample are not propagated to the position of theprediction sample that is far from the reference sample, and conversely,if the distance between the reference sample and the prediction sampleis close to each other, the correlation is high, and therefore, it maybe advantageous to improvement of the prediction performance toconstruct a prediction block through accurate interpolation so as tomaintain similarity as high as possible.

Therefore, the present embodiment proposes a method of selecting aninterpolation filter as below.

1) Selecting an interpolation filter under the consideration of only thesize of the current prediction block

2) Selecting an interpolation filter under the consideration of only theprediction mode applied to the current block

3) Setting an area in the current block, and selecting an interpolationfilter depending on the distance from the reference sample

4) Selecting the interpolation filter depending on the distance betweenthe reference sample and the prediction target sample within the currentblock

5) Selecting an interpolation filter by the combination of 1), 2), 3)and 4)

As an example, in a case where the intra prediction is performed on a4×4 block, since the prediction samples within the current block havinga block size of 4×4 exhibit a very high correlation with neighboringreference samples, a sophisticated interpolation filter may be usedregardless of the prediction mode. That is, the interpolation filter maybe selected under the consideration of only the size of the currentblock.

Alternatively, as an example, in the case of the prediction mode havingan intraPredAngle value of 11 or greater in Table 2, which has beenderived from the prediction mode of the current block regardless of thecurrent block size, the interpolation filter with a low-pass filtereffect may be used because the distance from the reference sample isincreased. That is, the interpolation filter may be selected under theconsideration of the prediction mode applied to the current block.

Alternatively, as another example, when the size of the current block isless than the predetermined block size, and the intraPredAngle value forthe prediction mode is less than a specific value, a sophisticatedinterpolation filter is used, and otherwise an interpolation filter witha low-pass filter effect may be used. That is, when selecting theinterpolation filter, both the size of the current block and thedirection of the prediction mode may be considered. For example, theprediction angle between the direction of the prediction mode of thecurrent block and the vertical direction or the horizontal direction maybe compared with a predetermined threshold value, and the interpolationfilter may be derived as either a first interpolation filter or saidsecond interpolation filter depending on the comparison result of theprediction angle and the threshold value.

Alternatively, the reference of an intraPredAngle value for a predictionmode for selecting an interpolation filter in response to the size ofthe current block may be differently applied. That is, the thresholdvalue may be set differently depending on the size of the current block.

Additionally, according to another example, when the prediction mode ofthe current block is derived as MPM, and is not the planar mode or DCmode, but the angular mode, the MPM mode for the current block and theinterpolation filter used for the current block may be derived together.That is, the interpolation filter may be derived together with the MPMmode.

Alternatively, the reference of an intraPredAngle value for a predictionmode for selecting an interpolation filter in response to the size ofthe current block may be differently applied.

Alternatively, it may be determined whether to apply the size of thecurrent block to selecting an interpolation filter depending on the modeof the current block. For example, if the mode of the current block is apredetermined specific mode, the first interpolation filter may beselected, while, if the mode of the current block is not a predeterminedmode, it may be determined whether to apply the first interpolationfilter or the second interpolation filter by reconsidering the size ofthe current block. In this case, the predetermined mode may be aprediction mode indicating a diagonal direction, for example, predictionmode 2, 34, or 66.

In addition, according to another example, when the size of the currentblock is greater than or equal to a specific value, the block may bedivided into regions, and an interpolation filter may be selecteddepending on a distance between the region and a reference sample. Thesize of the region may be a fixed value promised between the encodingapparatus and the decoding apparatus, or may be derived by theprediction mode and/or the size of a block (Implicitly defined). As anexample, when the intra prediction mode is a vertical directionprediction block greater than or equal to 34, 16×16 may be divided into164×4 blocks, and then the prediction may be performed on the regions offrom 0 to 7 in raster scan order by using a reference sampleinterpolated with a sophisticated filter, and after that, the predictionmay be performed on the remaining regions by using a reference sampleusing an interpolation filter with a low-pass filter effect.

Alternatively, information on the size of a region and an individualinterpolation filter applicable to each region may be explicitlysignaled from the encoding apparatus to the decoding apparatus.

Alternatively, according to another example, the kind of theinterpolation filter may be determined by comparing a distance between areference sample and a prediction sample within a current block to bepredicted with a specific threshold value. In other words, theseparation distance between the prediction sample and the referencesample may be compared with a predetermined threshold value, and theinterpolation filter may be derived as either a first interpolationfilter or a second interpolation filter depending on a comparison resultof the separation distance and the threshold value.

Meanwhile, information on a distance between a prediction sample and areference sample, which determines an interpolation filter may bederived in various ways depending on a block size, a prediction mode,and whether the prediction block is a square/nonsquare block. In thiscase, the separation distance may be derived based on the predictionmode of the current block, and the threshold value may be set based onthe size of the current block.

For example, if the size of the current block is N, and the distancebetween the reference sample and the prediction sample within theprediction block is N/2 or greater, then an interpolation filter with alow-pass filter effect may be used, and otherwise, a sophisticatedinterpolation filter may be used on a sample.

That is, when the separation distance exceeds the threshold value, theinterpolation filter is derived as the first interpolation filter, andwhen the separation distance is equal to or less than the thresholdvalue, the interpolation filter may be derived as the secondinterpolation filter, and the first interpolation filter may be aGaussian filter and the second interpolation filter may be a cubicfilter.

Alternatively, information on a threshold value for a distance between aprediction sample and a reference sample, which determines aninterpolation filter, may be transmitted from the encoding apparatus tothe decoding apparatus.

According to an embodiment of the present document, a spline filter or acubic filter may be used as the above-described sophisticatedinterpolation filter. In addition, as an interpolation filter with alow-pass filter effect, the linear filter or the Gaussian filter may beused.

FIG. 12 is a control flowchart illustrating an intra prediction methodaccording to another embodiment of the present document. Referring toFIG. 12, the intra prediction method using the reference filterdescribed above is summarized as below. FIG. 12 may be performed by theabove-described predictor of the encoding apparatus and the decodingapparatus.

First, the predictor may determine whether the intra prediction mode ofthe current block is an angle prediction mode, that is, an angularprediction mode (S1200).

As a result of the determination, if the intra prediction mode of thecurrent block is the angular mode, the predictor may determine whetherthe distance between the reference sample and the prediction samplewithin the current block is less than a predetermined third thresholdvalue (S1210).

In contrast, as a result of the determination, if the intra predictionmode of the current block is not the angular mode but the non-angularmode, that is, the planar mode or the DC mode, the predictor may performintra prediction on the current block based on the reference samples(S1240).

If the distance between the prediction sample and the reference sampleis less than the third threshold value, a sophisticated interpolationfilter, for example, a cubic filter, may be used as a filter forinterpolating the reference sample of the current block (S1220).

Contrarily, if the size of the current block is equal to or greater thanthe third threshold value (S1210), the predictor may interpolate thereference sample using a low-pass filter, for example, a Gaussian filter(S1230).

As described above, according to the present embodiment, the kind of theinterpolation filter may be determined by comparing a distance between areference sample and a prediction sample within a current block to bepredicted with a specific threshold value. In other words, theseparation distance between the prediction sample and the referencesample may be compared with a predetermined threshold value, and theinterpolation filter may be derived as either a first interpolationfilter or a second interpolation filter depending on a comparison resultof the separation distance and the threshold value.

Meanwhile, information on a distance between a prediction sample and areference sample, which determines an interpolation filter may bederived in various ways depending on a block size, a prediction mode,and whether the prediction block is a square/nonsquare block. In thiscase, the separation distance may be derived based on the predictionmode of the current block, and the threshold value may be set based onthe size of the current block. Since the distance between the predictionsample and the reference sample increases as the prediction mode of thecurrent block becomes far away from the vertical or horizontaldirection, the prediction mode of the current block may be consideredwhen determining the separation distance. Further, as the size of thecurrent block increases, the separation distance between the referencesample and the bottom right samples of the current block increases.Therefore, the size of the current block may also be considered whendetermining the separation distance.

For example, if the size of the current block is N, and the distancebetween the reference sample and the prediction sample within theprediction block is N/2 or greater, then an interpolation filter with alow-pass filter effect may be used, and otherwise, a sophisticatedinterpolation filter may be used on a sample.

That is, when the separation distance exceeds the threshold value, theinterpolation filter is derived as the first interpolation filter, andwhen the separation distance is equal to or less than the thresholdvalue, the interpolation filter may be derived as the secondinterpolation filter, and the first interpolation filter may be aGaussian filter and the second interpolation filter may be a cubicfilter.

Alternatively, according to an example, in order to determine thedistance between the prediction sample and the reference sample, theprediction angle between the direction of the prediction mode of thecurrent block and the vertical direction or the horizontal direction maybe compared with a predetermined threshold value, and the interpolationfilter may be derived as either a first interpolation filter or saidsecond interpolation filter depending on the comparison result of theprediction angle and the threshold value. In this regard, the thresholdvalue may be set differently depending on the size of the current block.

Meanwhile, the interpolation filter according to the present embodimentmay be a 4-tap filter.

Information on a threshold for a distance or a prediction angle betweena prediction sample and a reference sample, which determines theinterpolation filter, may be transmitted from the encoding apparatus tothe decoding apparatus, or may be derived from the encoding apparatusand the decoding apparatus by a predetermined table.

When the filter for interpolating the reference sample is derived, thepredictor may derive a prediction sample for the current block byperforming intra prediction on the current block (S1240).

Alternatively, according to another embodiment of the present document,based on the intra prediction method described with reference to FIGS. 4to 10, a method is proposed in which fractional samples are generatedusing two or more types of interpolation filters, a prediction value iscreated using reference samples generated by a plurality ofinterpolation filters, and then the prediction values are weightedsummed and used as a final prediction block.

As mentioned above, the distance between the reference sample and theprediction sample is determined depending on the prediction angle, thatis, the slope of the prediction mode. As the prediction sample withinthe current block is located further toward the bottom-right direction,the distance between the prediction sample and the reference sampleincreases, while, as the intraPredAngle value defined in Table 2increases, the slope of the prediction mode becomes closer to 45 degree,and the distance from the reference sample further increases. Also,since the distance between the reference sample and the predictionsample may also be determined by the size of the current block, the sizeof the block is also closely related to the accuracy of prediction.

In addition, when the value of intraPredAngle is greater than 0 and lessthan 32, prediction is performed from the position of a sub pel, thatis, a fractional sample, as shown in FIG. 7. In this regard, since onlypixel values at integer positions exist, the position of the fractionalsample is first predicted using the interpolation filter, and then thepredicted fractional sample value is copied to the prediction sample.Therefore, the accuracy of the prediction block may depend on theaccuracy of the interpolation filter. Alternatively, in a case where awide angle is applied and the intraPredAngle value is applied to Table4, if the intraPredAngle is equal to or greater than 32, and is not amultiple of 32, prediction may be performed from the position of thefractional sample. In addition, when a Gaussian filter is applied as aninterpolation filter, filter coefficients (filter coefficients atinteger sample positions) may be interpolated even in integer samples.

However, during the intra prediction, information that may be used asthe reference sample (reference sample value) is very limited to alreadyreconstructed samples on the left side and top, as shown in FIG. 6, andthe degree of correlation may rapidly decrease depending on the distancefrom the prediction sample. Therefore, it is effective to use theinterpolation filter with a low-pass filter effect so that artifacts ornoises of the reference sample are not propagated to the position of theprediction sample that is far from the reference sample, and conversely,if the distance between the reference sample and the prediction sampleis close to each other, the correlation is high, and therefore, it maybe advantageous to improvement of the prediction performance toconstruct a prediction block through accurate interpolation so as tomaintain similarity as high as possible.

Accordingly, in the present embodiment, there is proposed a method ofconstructing fractional samples from a plurality of interpolationfilters through the following process, and generating a prediction blockfor a current block by using the same.

1) Constructing a fractional sample from a filter that performssophisticated interpolation

2) Constructing a fractional sample from an interpolation filter withlow-pass filter characteristics

3) Constructing a fractional sample from an interpolation filter otherthan 1) and 2)

4) Using as the final prediction block by utilizing 1), 2), and 3)

The detailed method for process 4) is as below.

A) Using the average block of 1) or 2) or 3) as a final prediction block

B) Using the weighted average block of 1) or 2) or 3) as a finalprediction block

C) Selecting one among 1), 2), or various combinations of 3) and 4) andusing it as the final prediction block

As an example, when predicting for an angular mode that performs intraprediction from the position of a fractional sample (all angular modesexcept intra prediction modes 2, 18, 34, 50, and 66 in FIG. 4), aprediction block is constructed after interpolation is performed with acubic filter and a Gaussian filter, respectively. After that, theaverage sum of respective prediction blocks may be used as a finalprediction block.

Alternatively, using the characteristic of intra prediction that thecloser the distance between the reference sample and the predictionsample within the current block is, the higher the prediction accuracyis, a weighted sum prediction block may be used in proportion to thedistance between the prediction sample and the reference sample. Forexample, if the prediction samples are located close to the referencesample, the prediction sample made with 1) may be given more weight, andmore weight may be given to the prediction sample constructed from 2) asthe distance between the prediction sample and the reference sampleincreases, and then the final prediction block may be generated bysumming them.

Distance information for determining a weight may be calculated by anencoding apparatus and a decoding apparatus, or a table set depending ona block size and a prediction mode may be referred to.

In addition, the proposed method according to the present embodiment canbe selectively applied depending on various conditions. For example, aninterpolation filter may be selectively set in response to a block sizeto be predicted, a prediction mode, a variance of a reference samplevalue, etc., and for this, the block size, prediction mode, and variancevalues of the reference sample value may be derived by the decodingapparatus, or may be received as flag information from the encodingapparatus.

FIG. 13 is a control flowchart illustrating an intra prediction methodaccording to still another embodiment of the present document. Referringto FIG. 13, the intra prediction method using the reference filterdescribed above is summarized as below. FIG. 13 may be performed by theabove-described predictor of the encoding apparatus and the decodingapparatus.

First, the predictor may determine whether the intra prediction mode ofthe current block is an angle prediction mode, that is, an angularprediction mode (S1300).

As a result of the determination, if the intra prediction mode of thecurrent block is an angular mode, the predictor may primarilyinterpolate the reference sample with a cubic filter (S1310), andperform the first intra prediction based on the reference sampleinterpolated with the cubic filter (S1320). That is, the predictor maygenerate the first intra prediction block by using the reference sampleinterpolated by using a sophisticated filter such as a cubic filter.

In addition, if the intra prediction mode of the current block is anangular mode, the predictor may secondarily interpolate the referencesample with a Gaussian filter (S1330), and perform the second intraprediction based on the reference sample interpolated with the Gaussianfilter (S1340). That is, the predictor may generate the 21st intraprediction block using a reference sample interpolated using a lowfilter band filter such as a Gaussian filter.

Thereafter, the predictor may generate a final intra prediction block bya weighted sum of the first intra prediction and the second intraprediction (S1350).

In this case, as shown in FIG. 13, a weight α may be applied to thefirst intra prediction, and a weight (1−α) may be applied to the secondintra prediction. As described above, the weight α may vary depending onthe distance between the reference sample and the prediction samples,and information on the weight may be explicitly transmitted or derivedfrom the encoding apparatus and the decoding apparatus.

In contrast, in S1300, if it is determined that the intra predictionmode of the current block is not the angular mode but the non-angularmode, that is, the planar mode or the DC mode, the predictor may performintra prediction on the current block based on the reference samples(S1360).

Hereinafter, there is proposed a method of reconstructing a buffer of areference sample when the size of the interpolation filter that can beused in the above-described embodiment is 2 or greater.

If the size of the interpolation filter is 2, the sub pel isinterpolated using two integer pels that are closest to the sub pel thatis the intersection point of the prediction angle and the referencesample, and prediction is performed using this. When the size of the subpel is a, the index of the integer pel may be obtained with FLOOR(a) andFLOOR(a)+1 (FLOOR means discard). In this case, the size of the maximumreference sample may be resolved by 2*WIDTH+1 or 2*HEIGHT+1. However,when interpolation is performed using two or more reference samples, themaximum reference sample size may increase to 2*WIDTH+(SIZE−1) or2*HEIGHT+(SIZE−1).

In addition, the reference sample may be reconstructed depending onwhether the prediction angle is a negative number or a positive number.When the prediction angle is a negative number, it means the angledefined in Table 3 (the modes of from Nos. 19 to 49 in which theapproximate value of tan−1θ is defined). In general, a main referencesample may be designated depending on whether a property of a predictionangle mainly performs prediction on a top reference sample or a leftreference sample. However, when the prediction angle is a negativenumber, angle prediction may be performed by constructing a buffer inadvance using a side reference sample according to the prediction anglein the main reference sample buffer.

FIG. 14 is a diagram illustrating how a reference sample is obtainedwhen a prediction angle is a negative number according to an example.

Referring to FIG. 14, a value for a prediction sample currently beingpredicted may be generated using a two-tap filter which has been appliedin HEVC, and this may be calculated with reference to the followingequation.

yInt=Flood(y+1)−tan⁻¹θ*(x+1)

yFrac=(y+1)−tan⁻¹θ*(x+1)−yInt

predSample=(1−yFrac)*p[yInt]+yFrac*p[yInt+1]  [Equation 1]

As shown in FIG. 14, by padding in advance the side reference sample tobe used in the currently predicted pixel as the main reference sample,prediction of a negative number angle may be performed with only thepredAngleIntra variable in Table 3 without additional calculation.Likewise, the main reference sample buffer may be reconstructed toutilize only the reference pixel used for prediction of the positivenumber angle.

In this regard, when reconstructing the main reference sample buffer,only pixels necessary for prediction are input. Although a referencesample of 2*WIDTH+1 or 2*HEIGHT+1 size is constructed before reachingthe prediction module, the main reference sample buffer is reconstructedfor easy prediction value calculation.

Meanwhile, according to another embodiment of the present document, whena plurality of lines as reference samples, that is, a plurality ofreference samples adjacent to a block to be currently predicted, areused for intra prediction, the reference pixel may become longer than2*WIDTH+1, while, when intra prediction coding is performed by dividinga block to be currently coded in a horizontal direction or verticaldirection during intra prediction, such as an ISP (Intra Sub-Partitionsprediction), reference samples whose number is other than 2*WIDTH+1 maybe used because the length of the coding unit may become different fromthe length of the transform unit.

If the prediction angle is a negative number, and the interpolationmethod is performed with two reference pixels, then a buffer having asize of WIDTH+HEIGHT+1 was constructed. However, in the case of beingequal to or greater than that, a greater buffer should be allocated todeal with the worst case, so that no empty buffer (hole) may occur.

In this embodiment, the constructing of a 4-tap interpolation filterwill be described as an example. In this regard, when the referencesamples are designated as x0, x1, x2, and x3, it is assumed that the subpel exists between x1 and x2.

FIGS. 15 and 16 are diagrams illustrating how to perform paddingdepending on a negative angle and a positive angle when constructing amain reference sample buffer according to an example of the presentdocument. FIG. 15 shows padding the reference sample at a negativeangle, and FIG. 16 shows padding the reference sample at a positiveangle.

According to FIGS. 15 and 16, the main reference sample buffer isconstructed in the same way as when the interpolation filter is 2,wherein the padding is performed on pixels that do not exist, in orderto utilize the 4-tap filter.

In the case of the left main reference sample buffer of FIG. 15, a 2-tapfilter is illustrated as an example, and in the case of the mainreference sample buffer on the right side of FIG. 15, in order toutilize a 4-tap filter in a reference buffer such as a 2-tap filter, itis shown as an example that a pixel value that does not exist is padded(copied).

In the case of the left main reference sample buffer of FIG. 16, a 2-tapfilter is illustrated as an example, and in the case of the mainreference sample buffer on the right side of FIG. 16, in order toutilize a 4-tap filter in a reference buffer such as a 2-tap filter, itis shown as an example that a pixel value that does not exist is padded(copied).

FIGS. 17 and 18 are diagrams illustrating how to perform paddingdepending on a negative angle and a positive angle when constructing amain reference sample buffer according to another example of the presentdocument. FIG. 17 shows padding the reference sample at a negativeangle, and FIG. 18 shows padding the reference sample at a positiveangle.

According to FIGS. 17 and 18, the main reference sample buffer isconstructed in the same way as when the interpolation filter is 2,wherein, if a sample that has already been decoded in the neighbor isavailable to utilize a 4-tap filter, it is used as a prediction sample.Sample A of FIGS. 17 and 18 shows samples that have already beenrestored.

In the case of the left main reference sample buffer of FIG. 17, a 2-tapfilter is illustrated as an example, and in the case of the mainreference sample buffer on the right side of FIG. 17, in order toutilize a 4-tap filter in a reference buffer such as a 2-tap filter, itis shown as an example that samples that have already been reconstructedare utilized.

In the case of the left main reference sample buffer of FIG. 18, a 2-tapfilter is illustrated as an example, and in the case of the mainreference sample buffer on the right side of FIG. 18, in order toutilize a 4-tap filter in a reference buffer such as a 2-tap filter, itis shown as an example that samples that have already been reconstructedare utilized.

Meanwhile, according to another example, a method of padding a referencesample and a method of using a reconstructed sample may be used in placeof each other depending on the size of the block to be predicted, theprediction angle, and the control at a high level. For example, in thecase of a side sample (side reference) that is padded beyond height−1 inFIG. 17 described above, padding is performed, wherein it is alsopossible to make the most use of the reconstructed pixels available inthe main reference sample.

Meanwhile, a 4-tap interpolation filter among interpolation filters thatcan be used in the intra prediction method described in the presentdocument will be exemplarily described below.

When the fractional sample is in 1/32 pixel unit, the prediction samplewithin the prediction target block is as the following equation.

p[x][y]=(f[0]*ref[x+iIdx]+f[1]*ref[x+iIdx+1]+f[2]*ref[x+iIdx+2]+f[3]*ref[x+iIdx+3]+128)>>8  [Equation2]

Where p[x][y] denotes a sample position in the prediction block, ref[x]denotes a reference sample, and iIdx is an integer index of a point thatintersects the reference sample when mapped to the prediction mode(angle) in p[x][y], and may be represented byiIdx=((y+1)*intraPredAngle)>>5. f[n], n=0, 1, 2, 3 represents the filtercoefficients of the interpolation filter.

Further, according to an embodiment of the present document, in a casewhere a plurality of reference sample lines are used for intraprediction, if it is instructed with refidx to represent whether anyreference line is used or not, iIdx of Equation 2 may be modified as inEquation 3 below.

iIdx=(((y+1+refIdx)*intraPredAngle)>>5)+refIdx  [Equation 3]

The coefficients of the cubic filter, which is a sophisticatedinterpolation filter, and the Gaussian filter, which is a smoothedinterpolation filter with low-pass filter characteristics, are shown inTable 5 below. Table 6 shows coefficients of a Gaussian filter accordingto another example.

TABLE 5 Cubic filter Gaussian filter Sub-pel position n/32 {f[0], f[1],f[2], f[3]} {f[0], f[1], f[2], f[3]} n = 1 {−3, 252, 8, −1} {43, 161,51, 1} n = 2 {−5, 247, 17, −3} {40, 160, 54, 2} n = 3 {−7, 242, 25, −4}{37, 159, 58, 2} n = 4 {−9, 236, 34, −5} {34, 158, 62, 2} n = 5 {−10,230, 43, −7} {31, 156, 67, 2} n = 6 {−12, 224, 52, −8} {28, 154, 71, 3}n = 7 {−13, 217, 61, −9} {26, 151, 76, 3} n = 8 {−14, 210, 70, −10} {23,149, 80, 4} n = 9 {−15, 203, 79, −11} {21, 146, 85, 4} n = 10 {−16, 195,89, −12} {19, 142, 90, 5} n = 11 {−16, 187, 98, −13} {17, 139, 94, 6} n= 12 {−16, 179, 107, −14} {16, 135, 99, 6} n = 13 {−16, 170, 116, −14}{14, 131, 104, 7} n = 14 {−17, 162, 126, −15} {13, 127, 108, 8} n = 15{−16, 153, 135, −16} {11, 123, 113, 9} n = 16 {−16, 144, 144, −16} {10,118, 118, 10} n = 17 {−16, 135, 153, −16} {9, 118, 126, 11} n = 18 {−15,126, 162, −17} {8, 106, 127, 13} n = 19 {−14, 116, 170, −16} {7, 104,131, 14} n = 20 {−14, 107, 179, −16} {6, 99, 135, 16} n = 21 {−13, 98,187, −16} {6, 94, 139, 17} n = 22 {−12, 89, 195, −16} {5, 90, 142, 19} n= 23 {−11, 79, 203, −15} {4, 85, 146, 21} n = 24 {−10, 70, 210, −14} {4,80, 149, 23} n = 25 {−9, 61, 217, −13} {3, 76, 151, 26} n = 26 {−8, 52,224,−12} {3, 71, 154, 28} n = 27 {−7, 43, 230, −10} {2, 67, 156, 31} n =28 {−5, 34, 236, −9} {2, 62, 158, 34} n = 29 {−4, 25, 242, −7} {2, 58,159, 37} n = 30 {−3, 17, 247, −5} {2, 54, 160, 40} n = 31 {−1, 8, 252,−3} {1, 51, 161, 43}

TABLE 6 Gaussian filter Sub-pel position n/32 {f[0], f[1], f[2], f[3]} n= 1 {64, 128 64, 0} n = 2 {61, 116, 67, 12} n = 3 {59, 115, 69, 13} n =4 {57, 115, 71, 13} n = 5 {55, 114, 73, 14} n = 6 {53, 113, 75, 15} n =7 {50, 112, 76, 16} n = 8 {47, 111, 80, 18} n = 9 {45, 110, 82, 19} n =10 {43, 109, 84, 20} n = 11 {41, 108, 86, 21} n = 12 {40, 106, 88, 22} n= 13 {37, 105, 90, 24} n = 14 {36, 106, 92, 25} n = 15 {34, 101, 94, 27}n = 16 {32, 100, 96, 28} n = 17 {30, 98, 98, 30} n = 18 {28, 96, 100,32} n = 19 {27, 94, 101, 34} n = 20 {25, 92, 103, 36} n = 21 {24, 90,105, 37} n = 22 {22, 88, 106, 40} n = 23 {21, 86, 108, 41} n = 24 {20,84, 109, 43} n = 25 {19, 82, 110, 45} n = 26 {18, 80, 111, 47} n = 27{16, 78, 112, 50} n = 28 {15, 75, 113, 53} n = 29 {14, 73, 114, 55} n =30 {13, 71, 115, 57} n = 31 {13, 69, 116, 59}

Meanwhile, according to another example in this document, when thefilter scale is 64 (that is, when 1 is scaled up to 64, such as when thefilter coefficients are summed up and divided by 64 to provide 1), thecoefficients of the filter may be as shown in the table below.

TABLE 7 Fractional sample fC interpolation filter coefficients fGinterpolation filter coefficients position p f_(c)[ p ][ 0 ] f_(c)[ p ][1 ] f_(c)[ p ][ 2 ] f_(c)[ p ][ 3 ] fG[ p ][ 0 ] fG[ p ][ 1 ] fG[ p ][ 2] fG[ p ][ 3 ] 0 0 64 0 0 16 32 16 0 1 −1 63 2 0 15 29 17 3 2 −2 62 4 015 29 17 3 3 −2 60 7 −1 14 29 18 3 4 −2 58 10 −2 13 29 18 4 5 −3 57 12−2 13 28 19 4 6 −4 56 14 −2 13 28 19 4 7 −4 55 15 −2 12 28 20 4 8 −4 5416 −2 11 28 20 5 9 −5 53 18 −2 11 27 21 5 10 −6 52 20 −2 10 27 22 5 11−6 49 24 −3 9 27 22 6 12 −6 46 28 −4 9 26 23 6 13 −5 44 29 −4 9 26 23 614 −4 42 30 −4 8 25 24 7 15 −4 39 33 −4 8 25 24 7 16 −4 36 36 −4 8 24 248 17 −4 33 39 −4 7 24 25 8 18 −4 30 42 −4 7 24 25 8 19 −4 29 44 −5 6 2326 9 20 −4 28 46 −6 6 23 26 9 21 −3 24 49 −6 6 22 27 9 22 −2 20 52 −6 522 27 10 23 −2 18 53 −5 5 21 27 11 24 −2 16 54 −4 5 20 28 11 25 −2 15 55−4 4 20 28 12 26 −2 14 56 −4 4 19 28 13 27 −2 12 57 −3 4 19 28 13 28 −210 58 −2 4 18 29 13 29 −1 7 60 −2 3 18 29 14 30 0 4 62 −2 3 17 29 15 310 2 63 −1 3 17 29 15

As described above, according to this document, a method for aninterpolation filter that interpolates a reference sample under theconsideration of the size and the prediction mode of a current block andan intra prediction method using the same are provided. Further,according to the present document, a method and apparatus foreffectively deriving a reference sample under the consideration of adistance between a prediction sample and a reference sample areprovided.

FIG. 19 represents an example of a contents streaming system to whichthe present document may be applied.

Referring to FIG. 19, the content streaming system to which the presentdocument is applied may generally include an encoding server, astreaming server, a web server, a media storage, a user device, and amultimedia input device.

The encoding server functions to compress to digital data the contentsinput from the multimedia input devices, such as the smart phone, thecamera, the camcorder and the like, to generate a bitstream, and totransmit it to the streaming server. As another example, in a case wherethe multimedia input device, such as, the smart phone, the camera, thecamcorder or the like, directly generates a bitstream, the encodingserver may be omitted.

The bitstream may be generated by an encoding method or a bitstreamgeneration method to which the present document is applied. And thestreaming server may temporarily store the bitstream in a process oftransmitting or receiving the bitstream.

The streaming server transmits multimedia data to the user equipment onthe basis of a user's request through the web server, which functions asan instrument that informs a user of what service there is. When theuser requests a service which the user wants, the web server transfersthe request to the streaming server, and the streaming server transmitsmultimedia data to the user. In this regard, the contents streamingsystem may include a separate control server, and in this case, thecontrol server functions to control commands/responses betweenrespective equipments in the content streaming system.

The streaming server may receive contents from the media storage and/orthe encoding server. For example, in a case the contents are receivedfrom the encoding server, the contents may be received in real time. Inthis case, the streaming server may store the bitstream for apredetermined period of time to provide the streaming service smoothly.

For example, the user equipment may include a mobile phone, a smartphone, a laptop computer, a digital broadcasting terminal, a personaldigital assistant (PDA), a portable multimedia player (PMP), anavigation, a slate PC, a tablet PC, an ultrabook, a wearable device(e.g., a watch-type terminal (smart watch), a glass-type terminal (smartglass), a head mounted display (HMD)), a digital TV, a desktop computer,a digital signage or the like.

Each of servers in the contents streaming system may be operated as adistributed server, and in this case, data received by each server maybe processed in distributed manner.

1. An image decoding method performed by a decoding apparatus, themethod comprising: deriving an intra prediction mode for a currentblock; deriving reference samples adjacent to the current block;generating a prediction sample for the current block based on the intraprediction mode and the reference samples; and generating areconstructed picture for the current block based on the predictionsample, wherein the generating of the prediction sample for the currentblock includes: deriving an interpolation filter to be applied to thereference sample based on a prediction mode of the current block or thesize of the current block; and generating the prediction sample byapplying the derived interpolation filter to the reference sample. 2.The image decoding method of claim 1, wherein the deriving of theinterpolation filter includes: comparing a prediction angle between adirection of the prediction mode of the current block and a verticaldirection or a horizontal direction with a predetermined thresholdvalue; and deriving the interpolation filter as either a firstinterpolation filter or the second interpolation filter depending on acomparison result of the prediction angle and the threshold value. 3.The image decoding method of claim 2, wherein the threshold value is setdifferently depending on the size of the current block.
 4. The imagedecoding method of claim 2, wherein: the interpolation filter is derivedas a first interpolation filter based on the prediction angle beingexceed the threshold value; the interpolation filter is derived as asecond interpolation filter based on the prediction angle being lessthan or equal to the threshold value; and the first interpolation filteris a Gaussian filter, and the second interpolation filter is a cubicfilter.
 5. The image decoding method of claim 1, wherein the deriving ofthe interpolation filter includes: comparing a distance between theprediction sample and the reference sample with a predeterminedthreshold value; and deriving the interpolation filter as either a firstinterpolation filter or the second interpolation filter depending on acomparison result of the distance and the threshold value.
 6. The imagedecoding method of claim 5, wherein the distance is derived based on theprediction mode of the current block, and the threshold value is capableof being set based on the size of the current block.
 7. The imagedecoding method of claim 5, wherein: when the distance exceeds thethreshold value, the interpolation filter is derived as a firstinterpolation filter; when the distance is less than or equal to thethreshold value, the interpolation filter is derived as a secondinterpolation filter; and the first interpolation filter is a Gaussianfilter, and the second interpolation filter is a cubic filter.
 8. Animage encoding method performed by an encoding apparatus, the methodcomprising: deriving an intra prediction mode for a current block;deriving reference samples adjacent to the current block; generating aprediction sample for the current block based on the intra predictionmode and the reference samples; generating residual samples for thecurrent block based on the prediction sample; and encoding imageinformation including information on the intra prediction mode and theresidual sample, wherein the generating of the prediction sample for thecurrent block includes: deriving an interpolation filter to be appliedto the reference sample based on a prediction mode of the current blockor the size of the current block; and generating the prediction sampleby applying the derived interpolation filter to the reference sample. 9.The image encoding method of claim 8, wherein the deriving of theinterpolation filter includes: comparing a prediction angle between adirection of the prediction mode of the current block and a verticaldirection or a horizontal direction with a predetermined thresholdvalue; and deriving the interpolation filter as either a firstinterpolation filter or the second interpolation filter depending on acomparison result of the prediction angle and the threshold value. 10.The image encoding method of claim 9, wherein the threshold value is setdifferently depending on the size of the current block.
 11. The imageencoding method of claim 9, wherein: the interpolation filter is derivedas a first interpolation filter based on the prediction angle beingexceed the threshold value; the interpolation filter is derived as asecond interpolation filter based on the prediction angle being lessthan or equal to the threshold value; and the first interpolation filteris a Gaussian filter, and the second interpolation filter is a cubicfilter.
 12. The image encoding method of claim 8, wherein the derivingof the interpolation filter includes: comparing a distance between theprediction sample and the reference sample with a predeterminedthreshold value; and deriving the interpolation filter as either a firstinterpolation filter or the second interpolation filter depending on acomparison result of the distance and the threshold value. 13-15.(canceled)
 16. The image encoding method of claim 12, wherein thedistance is derived based on the prediction mode of the current block,and the threshold value is capable of being set based on the size of thecurrent block.
 17. Non-transitory computer-readable storage mediumstoring a bitstream causing a decoding apparatus to perform avideo/image decoding method, the method comprising: deriving an intraprediction mode for a current block; deriving reference samples adjacentto the current block; generating a prediction sample for the currentblock based on the intra prediction mode and the reference samples; andgenerating a reconstructed picture for the current block based on theprediction sample, wherein the generating of the prediction sample forthe current block includes: deriving an interpolation filter to beapplied to the reference sample based on a prediction mode of thecurrent block or the size of the current block; and generating theprediction sample by applying the derived interpolation filter to thereference sample.